import { ObjCreate } from "../../common/ObjCreate";
import { Language } from "../../../../../extend/language/Language";
import { GameDefConfig } from "../../../resource/GameDefConfig";
import { ItemData } from "../../../resource/info/ItemData";
import { EquipmentUtil } from "../../common/util/EquipmentUtil";
import { GLabel } from "../../../../../com/mui/controls/GLabel";
import { ScaleBitmap } from "../../../../../com/mui/display/ScaleBitmap";
type int = number;
//class EmbedSpecialJewelInfo
    
    export  class EmbedSpecialJewelInfo /* flash.display.Sprite */
    {
        constructor()
        {
            
            this._bg = ObjCreate.createBg(0, 0, 110, 66, this);
            ObjCreate.createLabel(Language.getString(90290), 3, 2, 110, 20, flash.text.TextFormatAlign.LEFT, this, true, 16702014);
            this.jewel1 = ObjCreate.createLabel("", 0, 22, 100, 20, flash.text.TextFormatAlign.CENTER, this, true, 16776960);
            this.jewel2 = ObjCreate.createLabel("", 0, 42, 100, 20, flash.text.TextFormatAlign.CENTER, this, true, 16776960);
            this.jewel3 = ObjCreate.createLabel("", 0, 62, 100, 20, flash.text.TextFormatAlign.CENTER, this, true, 16711680);
            return;
        }

        public setJewelType(arg1: int, arg2: int, arg3: int): void
        {
            var loc1=GameDefConfig.instance.getEJewel(arg1);
            var loc2=GameDefConfig.instance.getEJewel(arg2);
            var loc3=GameDefConfig.instance.getEJewel(arg3);
            this.jewel1.htmlText = loc1 ? loc1.text1 : "";
            this.jewel2.htmlText = loc2 ? loc2.text1 : "";
            this.jewel3.htmlText = loc3 ? loc3.text1 : "";
            return;
        }

        public setJewelTypeString(arg1: string, arg2: string, arg3: string, arg4: ItemData=null): void
        {
            if (arg3 != "") 
            {
                this._bg.height = 86;
            }
            else 
            {
                this._bg.height = 66;
            }
            this.jewel1.htmlText = this.findStr(arg1, arg4);
            this.jewel2.htmlText = this.findStr(arg2, arg4);
            this.jewel3.htmlText = this.findStr(arg3, arg4);
            return;
        }

        /* internal  */findStr(arg1: string, arg2: ItemData): string
        {
            if (EquipmentUtil.isCanEmbedDoubleJewel(arg2)) 
            {
                if (arg1.indexOf("#") != -1) 
                {
                    return arg1.replace("#", "、");
                }
                return arg1;
            }
            return arg1.split("#")[0];
        }

        /* internal */ /* var */jewel1: GLabel;

        /* internal */ /* var */jewel2: GLabel;

        /* internal */ /* var */jewel3: GLabel;

        /* internal */ /* var */_bg: ScaleBitmap;
    }
